package toster;

import java.util.ArrayList;
import java.util.Vector;


/**
 *
 * @author zach
 */
public class engine {
        int[][] horizontal_basecase;
        int[][] vertical_basecase;

        public Perms[] horz;
        public Perms[] vert;

        public Vector<boolean[][]> Power_set(boolean ishorz){
            if(ishorz){
                Vector<boolean[][]> out=new Vector<boolean[][]>();
                int[][][] powerset=new int[horz.length][][];
                int sum=0;
                for(int i=0;i<horz.length;i++){
                    powerset[i]=horz[i].getAll();
                    sum+=powerset[i].length;
                }

                for(int i=0;i<sum;i++){
                    boolean[][] zig=new boolean[horz.length][powerset[0][0].length];
                    for(int y=0;y<powerset.length;y++){
                        zig[y]=Function.convert(powerset[y][i%powerset[y].length]);
                    }
                    out.add(zig);
                }
                return out;
            }else{
                Vector<boolean[][]> out=new Vector<boolean[][]>();
                int[][][] powerset=new int[vert.length][][];
                int sum=0;
                for(int i=0;i<vert.length;i++){
                    powerset[i]=vert[i].getAll();
                    sum+=powerset[i].length;
                }

                for(int i=0;i<sum;i++){
                    boolean[][] zig=new boolean[vert.length][powerset[0][0].length];
                    for(int y=0;y<powerset.length;y++){
                        zig[y]=Function.convert(powerset[y][i%powerset[y].length]);
                    }
                    out.add(zig);
                }
               return out;
            }
        }

        public engine(int[][] horz,int[][] vert){
            horizontal_basecase=horz;
            vertical_basecase=vert;
            
            this.horz=new Perms[horizontal_basecase.length];
            this.vert=new Perms[vertical_basecase.length];
        }


   }

